# -*- coding:utf-8 -*-
import os
import time

from loguru import logger

current_path = os.path.abspath(os.path.dirname(__file__))
project_path = os.path.dirname(current_path)
log_path = os.path.join(project_path, 'logs')
if not os.path.exists(log_path):
    os.mkdir(log_path)

log_path_all = os.path.join(log_path, f'log-{time.strftime("%Y_%m_%d")}-all.log')
log_path_error = os.path.join(log_path, f'log-{time.strftime("%Y_%m_%d")}-error.log')
myLogger = logger
myLogger.add(log_path_all, rotation="50MB", encoding='utf-8', enqueue=True, retention="60 day")
myLogger.add(log_path_error, rotation="50MB", encoding='utf-8', enqueue=True, retention="60 day", level='ERROR')
